<?php

class Newsletter
{
	private $id;
	private $title;
	private $date;
	private $sent;
	private $style;
	private $content = NULL;
	
	public function __construct($id = NULL, $title = '', $date = 0, $sent = FALSE, $style = '')
	{
		if (!$date)
		{
			$date = time();
		}
		$this->id = $id;
		$this->title = $title;
		$this->date = $date;
		$this->sent = $sent;
		$this->style = $style;
	}
	
	public function getId()
	{
		return $this->id;
	}
	
	public function getTitle()
	{
		return $this->title;
	}
	
	public function getDate()
	{
		return $this->date;
	}
	
	public function getSent()
	{
		return $this->sent;
	}
	
	public function getStyle()
	{
		return $this->style;
	}
	
	/**
	 * 
	 * Returns the Content-Array. If it is NULL, the data will be fetched by the Manager
	 * 
	 */
	public function getContent()
	{
		if ($this->content == NULL)
		{
			//$this->content = NewsManager::getContentForNewsletter($this->id);
		}
		return $this->content;
	}
	
	public function setId($id)
	{
		$this->id = $id;
	}
	
	public function setTitle($title)
	{
		$this->title = $title;
	}
	
	public function setDate($date)
	{
		$this->date = $date;
	}
	
	public function setSent($sent)
	{
		$this->sent = $sent;
	}
	
	public function setStyle($style)
	{
		$this->style = $style;
	}
	
	/**
	 * 
	 * Sets the Content-Array
	 * @param array $content
	 * @throws InvalidArgumentException
	 */
	public function setContent($content)
	{
		if (is_array($content))
		{
			$this->content = $content;
		}
		else
		{
			throw new InvalidArgumentException("Argument has to be an array");
		}
	}
	
}

?>